#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
void solve()
{
    ll n;
    cin >> n ;
    vector<ll> a(n+1,0),b(n+1);
    for(int i=1;i<=n;i++)
    {
        cin >> a[i];
    }
    ll q;
    cin >> q;
    while(q--)
    {
        ll l,r;cin >> l >> r;
        b[l] = a[l];
        cout << b[l] << " ";
        for (int i = l+1; i <= r; i++)
        {
            b[i] = a[i] - a[i - 1];
            cout << b[i] << " ";
        }
        cout << endl;
    }
}
int main()
{
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
